Variable length coding/decoding method of image data and apparatus thereof

ABSTRACT

A method of variable length coding/decoding of image data and an apparatus thereof can vary the length of an escape sequence during variable length coding to thereby reduce the amount of transmitted data. 
     The method of variable length coding/decoding includes the steps of loading an initial potential maximum run length; determining a number of bits necessary to express the potential maximum run length, coding a run length using the necessary number of bits and decreasing the potential maximum ran length by an amount equal to the previously coded run length to arrive at a new potential maximum ran length until an end of a block to be encoded has been reached.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a coding and decoding method of adigital image data and an apparatus thereof, and more particularly to avariable length coding/decoding method of an image data and an apparatusthereof which can vary the length of an escape sequence during avariable length coding to thereby reduce the amount of a transmittingdata to transmit and similarly to thereafter reduce the amount ofreceived data to decode.

2. Description of the Prior Art

Recently, in order to improve picture quality, a method has becomepopular an image in which signal is coded and processed by digital data.

However, when an image signal is digitally encoded, the amount of databecome voluminous.

Therefore, encoding transformations such as Differential Pulse CodeModulation DPCM, vector quantization, Variable Length Coding and thelike are performed in order to reduce the large amount of data byremoving redundant data contained in the digital image signal.

FIG. 1 is a block diagram for schematically illustrating a conventionaldigital signal coding apparatus, the apparatus comprising the means for:performing a transform by Discrete Cosine Transform DCT method on an N×Nblock to thereby quantize a transform coefficient; performing a variablelength coding on quantized data to thereby compress the data amountsubstantially; and performing an inverse quantization and inversetransform on the quantized data to thereby perform a motioncompensation.

In FIG. 1, the image signal is input through an input terminal 10 and istransformed to a signal of a frequency region on an N×N block unit at anN×N transform unit 11 and an energy of coefficient thus transformed ismainly gathered towards low frequency components.

A data transformation is performed on each block by methods such as aDCT, Walsh-Hadamard Transform WHT, Discrete Fourier Transform DFT,Discrete Sine Transform and the like.

A quantization unit 12 transforms the transform coefficients torepresentative values of certain levels through a predeterminedquantization process.

A variable length coding unit 13 based on statistical characteristics ofthe representative values, performs the variable length coding, so thatthe data can be markedly compressed.

Meanwhile, in accordance with a state of a buffer 14 where avariable-length-coded data is stored, a transformed quantization stepsize Qss controls the quantization unit to thereby adjust a transmissionbit ratio. The quantization step size Qss can be transmitted to areceiving end to thereby be utilized by a decoding apparatus.

Furtheremore, because there are usually many similarities betweenportions of screens, and in the case of a screen containing motion, themotion is estimated to thereby calculate a vector thereof, and if a datais compensated by utilizing the vector, and because a difference signalbetween neighboring screens is very small, the transmission data can besubstantially compressed.

In order to perform a motion compensation, an inverse quantization unit15 and an N×N inverse transform unit 16 in FIG. 1 perform an inversequantization on the quantized data output from the quantization unit 12to thereafter inversely transform the same, so that the same can betransformed to an image signal within a spatial region.

The image signal output from the inverse transform unit 16 is stored perframe unit on a frame memory 17 and a motion estimating unit 18 seeks ablock pattern most similar to the N×N block data of the input terminal10 from the frame data stored in the frame memory 17 to therebycalculate a motion vector MV representing a motion between the twoblocks.

The motion vector is transmitted to the receiving end to thereby beutilized by a decoding apparatus and at the same time to thereby betransmitted to a motion compensating unit 19.

The motion compensating unit 19 receives the motion vector MV from amotion estimating unit 18 and reads out an N×N block corresponding tothe motion vector MV from a prior frame data outputted from the framememory 17 to thereby supply the same to an adder A1 connected to theinput terminal 10.

Then, the adder A1 calculates a difference between an N×N block suppliedto the input terminal 10 and an N×N block of similar pattern suppliedfrom the motion compensating unit 19, and the output data of the adderA1 is coded to thereby be transmitted to the receiving end.

In other words, at first, the whole image signals are transmitted andthen only a difference signal corresponding to the motion, istransmitted.

Meanwhile, the data whose motion has been compensated at the motioncompensating unit 19 is added together with the image signal output tothe N×N inverse transform unit 16 by an adder A2 and this sum is storedon the frame memory 17.

A refresh switch (not shown) is occasionally rendered off by a controlmeans, and because the input image signal is coded by Pulse-CountModulation PCM mode to thereby be transmitted, only the differencesignal is coded, so that an accumulation of codes resulting from thetransmission can be refreshed after a predetermined time interval and atransmission error on a channel can be removed at the receiving endwithin a predetermined period of time.

In this manner, the coded image data is transmitted to the receiving endto thereby be input to the decoding apparatus as indicated in FIG. 2.

The coded image data is decoded at a variable length decoding unit 21via an inverse coding process.

The data input from the variable length decoding unit 21 is inverselyquantized at an inverse quantization unit 22.

Within the inverse quantization unit 22, the magnitude of an outputtransform coefficient is adjusted by the quantization step size Qsssupplied from the coding apparatus.

An N×N inverse transform unit 23 transforms a frequency region transformcoefficient supplied from the inverse quantization unit 22 into imagedata within a spatial region.

Furthermore, the motion vector MV transmitted from the coding apparatusas illustrated in FIG. 1 is supplied to a motion compensating unit 24 ofthe decoding apparatus, which reads out an N×N block corresponding tothe motion vector MV from a frame data stored on a frame memory 25 tothereafter compensate for the motion and to thereby supply the same toan adder A3.

Then, the adder A3 adds an inversly transformed DPCM data to an N×Nblock of data supplied from the motion compensating unit 24 to therebyoutput the same to a display unit.

FIGS. 3A-3C are schematic drawings for illustrating a quantizationprocess of an image data.

A sampling of image data of an N×N block as indicated in FIG. 3A istransformed to a transform coefficient of a frequency region asillustrated in FIG. 3B by a DCT and the like.

After the transform coefficient is quantized, the same is scanned in azig-zag pattern as illustrated in FIG. 3C to thereby be coded in aformal.

When the N×N block is scanned, a low frequency component is startedfirst as illustrated in FIG. 3C and then a high frequency component isscanned to thereby be coded as a “run” and “level” pair.

Here, the “run” corresponds to a number of “0's” existing among thenon-zero quantized coefficients of the N×N block and the “level”corresponds to an absolute value of the coefficients which are not “0”.

By way of example, in the case of an 8×8 block, the “run” can have avalue ranging from “0” to “63”.

The “level” varies according to a data value output from thequantization unit, for example, if a quantization output value isexpressed as an integer from “−255” to “+255”, the “level” comes to havea value from “1” to “255”.

The reference symbols, “+” or “−” are expressed by separate sign bits.

As seen from the foregoing, it is utilized as a symbol, and if the Runis large or Level is large, an occurring frequency of the symbols isvery low statistically.

Accordingly, as illustrated in FIG. 4, a regular region and escaperegion are partitioned according to the occurring frequency of thesymbols so that a Huffman code is utilized to thereby code the imagedata for the regular region where the occurring frequency is relativelyhigh, and the image data is coded utilizing an escape sequence for thesymbols in the escape region where the occurring frequency is low.

Here, the Huffman code allocates a short-length code when the occurringfrequency of symbol is high and a long length code is allocated when theoccurring frequency of symbol is low.

Furthermore, the escape sequence which has coded a data of escape regioncomprises an escape code ESC, run, level and sign data respectivelyhaving predetermined bits as indicated in the following formula (1)

Escape Sequence=ESC+RUN+L+S  Formula 1

For example, as mentioned in the aforesaid, when the quantized value atthe 8×8 block ranges “from −255 to 255”, the escape sequence has anescape code data ESC of 6-bit, a run data of 6-bit, a level data L of8-bit and a sign data RUN S of 1-bit, totalling 21-bit of fixed datalength.

In this way, in a conventional variable length coding method, variousadditional information was transmitted along with coded data, andfurthermore because the escape data has a predetermined fixed length,there has been a limit to coding the transmission data to therebycompress the data amount.

SUMMARY OF THE INVENTION

Accordingly, it is an object of the present invention to provide avariable length coding/decoding method image data and an apparatusthereof which can variably adjust a length of an escape data using avariable length coding method encoding a transmission signal to therebyimprove markedly a data compression efficiency.

In accordance with one aspect of the present invention there is provideda variable length coding/decoding method of an image data, the methodcomprising the processes of: transforming sampled image data to atransform coefficient of frequency region, quantizing and scanning thesame in a predetermined direction, so at symbol data having a “run” anda “level” as a pair can be calculated (first process); coding andtransmitting the symbol data calculated from the first process byHuffman code when the data belongs to a regular region, and when thedata belongs to an escape region, coding the turn up to the maximum runlength in a bit number which can express the run, and coding andtransmitting the “level” by determining the bit numbers necessary for anexpression in accordance with a quantization step size (second process);and discriminating the coded data transmitted from the second process bya data length of the run and level to thereafter decode the same (thirdprocess).

In accordance with another aspect of the present invention, there isprovided a variable length coding/decoding apparatus forencoding/decoding image data, the apparatus comprising the means of:dividing an image data into blocks having predetermined numbers ofsampling data, transforming the sampled data to a transform coefficientof frequency region, quantizing and scanning the same in a predetermineddirection and calculating a symbol having the “run” and “level” as apair (first means); coding the symbol data calculated from the firstmeans by Huffman code when the data belongs to a regular region (secondmeans); the “run” in a bit number which can express the run up to amaximum run length when the symbol calculated from the first meansbelongs to an escape region, and coding and transmitting the “level” bydetermining the bit numbers necessary for an expression in accordancewith a quantization step size (third means); and discriminating thecoded data transmitted from the third means by a data length of the runand level to thereafter decode the same (fourth means).

BRIEF DESCRIPTION OF THE DRAWINGS

For fuller understanding of the nature and objects of the invention,reference should be made to the following detailed description taken inconjunction with the accompanying drawings in which:

FIG. 1 is a block diagram for illustrating one embodiment of aconventional image data coding apparatus;

FIG. 2 is a block diagram for illustrating one embodiment of aconventional image data decoding apparatus;

FIGS. 3A-3C are schematic drawings for illustrating a conventionalquantization process of the image data;

FIG. 4 is a region diagram in accordance with an occurring frequency ofa symbol during a conventional two dimentional Huffman coding;

FIG. 5 is a block diagram for illustrating a preferred embodiment of avariable length coding apparatus in accordance with the presentinvention;

FIG. 6 is a flow chart of one embodiment of a variable length codingmethod in accordance with the present invention;

FIG. 7 is a flow chart of another embodiment of an improved variablelength coding method in accordance with the present invention; and

FIG. 8 is a flow chart of a preferred embodiment of a variable lengthdecoding method in accordance with the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Hereinafter, a preferred embodiment of the present invention will bedescribed in detail with reference to the accompanying drawings.

The apparatus in FIG. 5 comprises: a delayer 51 which is loaded with apredetermined value when a variable length coding operation on eachblock is started, and is supplied with a run value of [run, level]symbol capable of expressing a maximum run length; a run coded lengthdetermining unit 52 for determining a bit number NBr necessary forcoding data in accordance with the maximum potential run value suppliedfrom the delayer 51; a run coding unit 53 for coding the run data inaccordance with the bit number NBr determined by the run coded lengthdetermining unit 52; a level coded length determining unit 54 fordetermining a bit number NB1 necessary for expressing a level value byreceiving a quantization step size Qss; and a level coding unit 55 forcoding the level data in accordance with the bit number NB1 determinedby the level coded length determining unit 54.

When variable length coding is started on each block, a block startsignal BST is inputted to the delayer 51 to thereby load an initialvalue.

For example, in the case of an 8×8 block, “63” is loaded into thedelayer 51.

When the [run, level] symbol is applied, the run data and “1” are addedtogether by the first adder A1, and the second adder A2 subtracts thevalue thereof from the maximum potential rum value stored on the delayer51.

Subsequently, a delayer 51 outputs the decreased new maximum potentialrun value.

The run coded length determining unit 52 determines the number of bitsNBr necessary for coding the run data in accordance with the maximumpotential run value supplied from the delayer 51.

Then, the run coding unit 53 codes the run data in a substantiallysmaller number of bits to thereby output coded run data in accordancewith the bit number NBr determined from the run coded length determiningunit 52.

Furthermore, the level coded length determining unit 54 determines thenumber of bits NB1 necessary for expressing the level in accordance withan incoming quantization step size Qss.

In other words, a number of values which a quantization output level canpossess can be determined when the maximum potential value of thetransform coefficient is divided by the quantization step size, Qss sothat the number of bits NB1 necessary for expressing the level can bedetermined.

Then, the level coding unit codes the level data into a substantiallysmaller number of bits to thereby output the same in accordance with thenumber of bits NB1 determined by the level coded length determining unit54.

For example, an explanation is given below in a case where the run valueof the [run, level] symbol supplied to the apparatus of FIG. 5 is“000011” using 6-bits, and the level value is “00001010” of 8-bit.

First, a run value of “000011” is added with “1” at the first adder A1to thereby be supplied to the second adder A2, and the second adder A2subtracts an input run value from the current maximum potential runvalue.

A result thereof is utilized in order to process the subsequent [run,level], and as for the currently-inputted run data, in accordance withthe maximum potential run stored in the delayer 51, the run coded lengthis determined to thereby be run-coded.

In other words, in case of the 8×8 block, because the maximum potential“run” at the initial stage is “63” which is stored in the delayer 51,the run coded length determining unit 52 determines the run coded lengthNBr to be 6-bits to thereby output the same.

The value “63” is inputted to the adder A2, and “1” is added to the rundata to thereby subtract that sum from the value “63” and to input thatdifference to the delayer 51.

In this way, the maximum potential “run” is decreased, so that thenumber of bits representing the “run” is decreased.

If the maximum potential run stored on the delayer 51 is assumed as “6”because the “6” can be expressed in 3-bits, then the run coded lengthdetermining unit 52 determines the run coded length NBr to be 3-bits andthereby outputs the number of bits NBr as “3”.

Then, the run coding unit 53 finally codes “000011” of the run data as“011” to thereby output the same.

Furthermore, if the quantization step size Qss supplied to the levelcoded length determining unit 54 is relatively a large value and thenumber of potential quantized values is 50, then 50 quantized values canbe expressed in 6-bits, and the level coded length determining unit 54determines 6-bits as the level coded NB1 to thereby output a value of“6”.

Then, the level coded unit 55 finally codes “00001010” of level data as“001010” in 6-bits of level data to thereby output the same.

Accordingly, because the escape sequence run data has a data length from“0-bit” to “6-bit” and the level data has a data length from “0-bit” to“8-bit” the escape sequence adds the escape code data of “6-bit”, therun data from “0-bit” to “6-bit”, the level data from “0-bit” to “8-bit”and “1-bit” of sign data to thereby make a variable length of “7-bit” to“21-bit”.

In other words, the variable length corresponds to a data length whereinunnecessary leading “0's” are removed from the run data and level dataof the escape sequence.

Meanwhile, because a pointer position under a current scan of the codingapparatus automatically corresponds to that of a decoding apparatus, thenumbers of bits necessary for expressing the run value can besynchronized even though additional information is not sent.

Furthermore, even in the case of the level, because the quantizationstep size is transmitted to a decoding apparatus for an inversequantization, the number of bits necessary for expressing the level canbe synchronized by utilizing the quantization step size, so that noadditional information is needed.

FIG. 6 is a flow chart of one embodiment of a variable length codingmethod in accordance with the present invention.

First of all, when a variable length coding on random block is started,a block start signal BST is generated, step 601, and an initial value isloaded on the delayer, step 602.

The block is scanned and the initial value is set to correspond to amaximum potential run value among the coded run values.

In the present invention, because the block 8×8 is thus having “63” asan initial value, the number of the run coded length is established as“6”, step 603, and the level coded length is determined by thequantization step size, step 604.

Then, when a symbol data of [run, level+code] is inputted, step 605, theflow discriminates whether the symbol data belongs to the regularregion, step 606.

If the symbol data belongs to the regular region as a result of thediscrimination, a regular Huffman code is allocated in accordance with aprobability distribution to thereby be coded, step 607, and if the datadoes not belong to the regular region, the same is coded by the escapesequence, step 608.

In other words, because the run data and level data are coded inaccordance with the run coded length and level coded length determinedin the previous step, the escape sequence can be obtained.

Then, the current run data and “1” are subtracted from the currentmaximum potential run value to thereby calculate a new maximum potentialrun value, step 609.

The run coded length is determined by the new maximum potential runvalue, step 610.

The run coded length is utilized for determining a run data length in acoding process of subsequent symbol data.

In this manner, if the coded symbol belongs to the regular region, thesymbol is coded by the regular Huffman code to thereby be outputted, andif the symbol belongs to the escape region, the symbol is coded by theescape sequence to thereby be outputted.

Thereinafter, the coded data is discriminated as to whether the same isthe end of the block, step 611, and if the data is not the end of theblock, next [run, level+−code] symbol data is inputted, step 605, and ifthe data is the end of the block, a Huffman code corresponding to theend of the block is generated, step 612, and a notice is given that avariable length coding on one block has been finished.

In this way, the run data and level data have variable lengths andsubsequently the escape sequence has variable lengths ranging from“7-bit” to “21-bit”.

Therefore, in some cases, even in the case of a symbol of the regularregion, the coded data length can be markedly shortened by coding of theescape data instead of by a coding of the Huffman code.

FIG. 7 shows a process wherein variable length coding is performed onone block in accordance with a variable length coding method thusimproved.

A block start signal is generated, step 701, so that an initial maximumpotential run value is loaded, step 702.

Then, an initial run coded length (6-bit, as the 8×8 block is presentedin the present embodiment to thereby have a maximum potential run of“63”) is established, step 703, and according to the quantization stepsize, the level coded length is determined, step 704.

After a symbol data of [run, level+code] is inputted, step 705, a stepleading to a discrimination step as to whether the inputted symbol databelongs to the regular region is identical to the example indicated inFIG. 6.

If the discrimination result shows that the symbol data does not belongto the regular region, the run data and level data are coded accordingto the run coded length and level coded length determined in thepreceding steps to thereby output the escape sequence, step 709.

If the discrimination result shows that the symbol belongs to theregular region, the symbol data is coded by the regular Huffmam code,step 708 and at the same time, the escape sequence is coded, step 707.

Then, the length of the resulting Huffman code and the escape length arecompared, step 710, and the shorter data length of the two is outputted,steps 711 and 712.

In this manner, the resulting Huffman code or escape data is outputtedaccording to the region where the symbol belongs or to the data lengthto thereafter calculate the maximum potential run value, step 713, sothat the run coded length can be determined, step 714.

Then, a discrimination is made as to whether or not the coded symbol isan end of the block, step 715, and if the symbol is not the end of theblock, subsequent symbol data is supplied to thereby perform theaforesaid coded process.

If the symbol is the end of the block, a Huffman code corresponding tothe block end signal is generated, step 716.

FIG. 8 is a flow chart for explaining a preferred embodiment of thevariable length decoding method in accordance with the presentinvention.

First of all, when decoding is started on a block, a block start signalis generated, step 801, so that an initial maximum potential run valueis loaded, step 802.

Furthermore, the run coded length is set at 6-bit as an initial value,step 803, and the level coded length is determined according to thequantization step size transmitted from the coding apparatus, step 802.

Then, when the coded data is inputted from the coding apparatus, step805, the coded data is checked as to whether the data is the escapesequence, step 806.

If the checked result shows that the coded data is the escape sequence,a decoding process is performed on the escape sequence, step 807.

In other words, after the respective number of bits of the run data andlevel data are determined according to the run coded length and levelcoded length determined in the preceding steps, the escape data isclassified to fit to a respective data number of bits and is therebyinterpreted as the run data and level data, so that a decoding can berealized.

Meanwhile, if the discrimination result shows that the coded data is theregular Huffman code, the regular Huffman code is decoded, step 808.

After the decoded symbol data is outputted in this way, step 809, thedecoded run data and “1” are subtracted from the current maximumpotential run value, so that a new maximum potential run value can becalculated, step 810.

According to the calculated maximum potential run value, the new runcoded length is determined, step 811, and the run coded length isutilized in the decoding process of next coded data.

A discrimination is made as to whether the currently decoded symbol datais an end of the block, step 812, and if not a decoding processidentical to the one explained in the aforesaid is again performed byreceiving the coded data transmitted from the coding apparatus. If thesymbol data is the end of the block, a block end signal is generated,notifying a decoding process that one block has been finished, step 813.

As mentioned in the foregoing, a series of coding and decoding methodshave been described here in terms of two dimentional data, however thecoding and decoding methods having one-dimensional data or data having 2levels “0” and “1” can be applied as well, so that the length of theescape sequence to be coded can be variable.

As seen from the aforesaid, the variable length coding and decodingmethods and apparatuses in accordance with the present invention can becharacterized in that adaptively different coding and decoding methodscan be performed in accordance with the frequency of occurrence ofquantized symbol data to thereby compress the data. The length of rundata and level data of the data coded at the escape sequence can bevariably controlled to thereby be coded, and the transmitted data can besubstantially compressed by receiving the coded data to thereby decodein the same manner.

The foregoing description and drawings are illustrative and are not tobe taken as limiting. Still other variations and modifications arepossible without departing from the spirit and scope of the presentinvention.

What is claimed is:
 1. A method of variable length coding of image data,the method comprising the steps of: dividing the image data into aplurality of blocks, each said block formed of N×N pixels, wherein N isan integer; transforming each said block to obtain transformcoefficients of each said block; quantizing said transform coefficientsof each said block; scanning said quantized transform coefficients in apredetermined pattern within each said block to arrange the quantizedtransform coefficients into a one-dimensional sequence of transformcoefficients; converting said one-dimensional sequence into symbol datahaving a run component and a level component; determining a potentialmaximum run value; (1) determining whether said symbol data is foundwithin a regular region or an escape region; (2) assigning a Huffmancode to said symbol data if said symbol data is within said regularregion and outputting said Huffman code of said symbol; (3) if saidsymbol data is within said escape region, a) determining an escape codenumber of bits necessary to represent sod potential maximum run value;b) assigning a run code having the escape code number of bits to the runcomponent of said symbol data and outputting said assigned run code ofsaid ran length; c) decrementing said maximum run potential value by avalue equal to said run component plus one; d) determining a number oflevel bits based upon a quantization step size value; e) assigning acode to said level component using said number of determined level bitsand outputting said assigned level code of said level component; (4)determining if an end of the block has been reached, and asserting anend of block signal if the end of the block has been determined; and ifthe end of the block has not been reached, repeating steps (1)-(4).
 2. Amethod of variable length coding of image data as recited in claim 1wherein, said potential maximum run value is equal to N²−1 for the N×Nblock.
 3. A method of variable length coding of image data, the methodcomprising the steps of: dividing the image data into a plurality ofblocks, each said block formed of N×N pixels, wherein N is an integer;transforming each said block to obtain transform coefficients of eachsaid block; quantizing said transform coefficients of each said block;scanning said quantized transform coefficients in a predeterminedpattern within each said block to arrange the quantized transformcoefficients into a one-dimensional sequence of transform coefficients;converting said one dimensional sequence into symbol data having a runcomponent and a level component; determining a potential maximum runvalue; (1) determining whether said symbol data is found within aregular region or an escape region; (2) if said symbol data is found inthe regular region, assigning a Huffman code to said symbol data, (3) ifsaid symbol data is found in the regular region, a) determining anescape code number of bits necessary to represent said potential maximumrun value; b) assigning a run code having the escape code number of bitsto the run component of said symbol data; c) decrementing said potentialmaximum run value by a value equal to said run component plus one; d)determining a number of level bits based upon a quantization step sizevalue; e) assigning a code using said number of determined level bits tosaid level component; f) outputting said assigned Huffman code if anumber of bits of said assigned Huffman code is less than a number ofbits of said escape codes of said run length and level codes together;g) outputting said escape codes of said run length and level codestogether if the number of bits of said escape code of said run lengthand level codes together is less than the length of the assigned Huffmancode; (4) if said symbol data is within said escape region, a)determining an escape code number of bits necessary to represent saidpotential maximum run value; b) assigning a run code having the escapecode number of bits to the run component of said symbol data andoutputting said assigned run code of said run length; c) decrementingsaid maximum run potential value by a value equal to said run componentplus one; d) determining a number of level bits based upon aquantization step size value; e) assigning a code using said number ofdetermined level bits to said level component and outputting saidassigned level code of said level component; (5) determining if an endof the block has been reached, and asserting an end of block signal ifthe end of the block has been reached; and if the end of the block hasnot been reached, then repeating steps (1)-(5).
 4. A method of variablelength coding of image data as recited in claim 3 wherein, saidpotential maximum run value is equal to N²−1 for the N×N block.
 5. Anapparatus for variable length coding of image data, the apparatuscomprising: first means for dividing the image data into a plurality ofblocks, each said block formed of N×N pixels, wherein N is an integer;second means for transforming each said block to obtain transformcoefficients of each said block; third means for quantizing saidtransform coefficients of each said block; fourth means for scanningsaid quantized transform coefficients in a predetermined pattern withineach said block to arrange the quantized transform coefficients into aone-dimensional sequence of transform coefficients; fifth means forconverting said one dimensional sequence into symbol data having a runcomponent and a level component; sixth means for determining a potentialmaximum run value; seventh means for determining whether said symboldata is found within a regular region or an escape region, assigning aHuffman code to said symbol data if said symbol data is within saidregular region and outputting said Huffman code of said symbol; eighthmeans for determining an escape code number of bits necessary torepresent said potential maximum run value, assigning a run code havingthe escape code number of bits to the run component of said symbol dataand outputting said assigned run code of said run length, anddecrementing said potential maximum run value by a value equal to saidrun component plus one; ninth means for determining a number of levelbits based upon a quantization step size value, assigning a code to saidlevel component using said number of determined level bits andoutputting said assigned level code of said level component; tenth meansfor determining if an end of the block has been reached, and foroutputting an end of block signal.
 6. An apparatus for variable lengthcoding of image data as recited in claim 5, wherein said sixth meansdetermines that said potential maximum run value is N²−1 for an N×Nblock.
 7. An apparatus for variable length coding of image data asrecited in claim 5, wherein said eighth means comprises: a delayingmeans for loading, storing and outputting the potential maximum runvalue when coding on the block is started; a subtracting means forsubtracting from the potential maximum run value a value of a run lengthplus one; a run coding length determining means for determining a runcoded length, which is a number of bits necessary for expressing thepotential maximum run value supplied from the delaying means; a runcoding means for coding the run data in accordance with the run codedlength determined by the run coding length determining means; a levelcoding length determining means for determining a level coded length,which is a number of bits necessary for expressing a quantized valuecalculated according to a quantization step size; and a level codingmeans for coding the level data in accordance with the level codedlength determined by the level coding length determining means.
 8. Amethod of coding a data signal by means of runlength encoding,comprising the steps of: (a) storing a maximum potential runlength; (b)producing a runlength signal, having the number of bits required toexpress the stored maximum potential runlength from an input signalrepresenting run data based on whether symbol data corresponding to theinput signal is found in a regular region or an escape region, wherein aHuffman code is assigned if the symbol data is within said regularregion and a run code corresponding to an escape sequence is assigned ifthe symbol data is within said escape region; (c) producing a newmaximum potential runlength by subtracting said run data from apredetermined factor from the stored maximum potential runlength; (d)storing the new maximum potential runlength; and (e) repeating steps (b)to (d).
 9. A method of decoding a data signal, coded according to claim8 comprising the steps of: (a) storing a maximum potential runlength;(b) extracting run data from an input coded data signal, the extractedrun data having the same number of bits as the stored maximum potentialrunlength; (c) producing a new maximum potential runlength bysubtracting said run data and a predetermined factor from the storedmaximum potential runlength; (d) storing the new maximum potentialrunlength; and (e) repeating steps (b) to (d).
 10. A data signaldecoding apparatus comprising: storage means for storing a maximumpotential runlength; input means for receiving a coded data signal;decoding means responsive to the necessary bit length of a maximumpotential runlength stored in a storage means to output the runlengthdata of the coded data signal as a run signal having the same number ofbits as the stored maximum runlength; and means to generate a newpotential runlength in dependence on the run signal and the storedmaximum runlength.
 11. A method of decoding a digital data signal,comprising: (a) loading a maximum potential run value; (b) decoding rundata from an input compressed data signal, the decoded run data havingthe same number of bits as the maximum potential run value of (a); (c)producing a new maximum potential run value by subtracting said run dataand a predetermined factor from the maximum potential run value of (a);(d) determining whether the data signal is an end of the block; and (e)repeating (b) to (d) using the new maximum run value in place of maximumrun value if it is determined in (d) that the data signal is not the endof the block.
 12. A method of decoding a digital data signal accordingto claim 11 further comprising: (f) setting a run coded length to apredetermined value; and (g) determining a level coded length accordingto a quantization step size, wherein (a) is performed in response to ablock start signal.
 13. A variable length coded signal decoding methodcomprising: (a) determining the number of bits of a symbol of an inputsignal which convey run length data; (b) decoding said run length data;(c) decoding level data in said symbol; and (d) producing an outputsignal based on the decoded run length data and the decoded level data.14. A variable length coded signal decoding method comprising: (a)determining whether an input signal is one of a first signal accordingto a first code and a second signal produced by: (a1 ) storing a maximumpotential run value; (a2 ) producing from an input run data signal a runlength signal having a number of bits required for the stored maximumpotential run value; (a3 ) producing a new maximum potential run valueby subtracting said run length signal produced in (a2 ) and apredetermined factor from said maximum potential run value of (a1 ); (a4) storing the new maximum potential run value; and (a5 ) repeating (a2 )through (a5 ) using the new maximum potential run value in place of themaximum potential run value of (a1 ) and (b) decoding the input signalin response to a result of (a).
 15. The variable length coded signaldecoding method according to claim 14, wherein the second signal isfurther produced by; (a6 ) determining number of bits required torepresent a level signal based on a quantization step signal; and (a7 )producing a level signal having the number of bits determined in (a6 ),wherein (a6 ) and (a7 ) are performed prior to performing (a5 ).
 16. Thevariable length coded signal decoding method according to claim 15,wherein said first code is a Huffman code.
 17. The variable length codedsignal decoding method according to claim 14, wherein said first code isa Huffman code.